package com.google.code.netbuilder.services.equipment;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import com.google.code.netbuilder.dal.entities.Equipment;
import com.google.code.netbuilder.dal.providers.IEquipmentProvider;

/**
 * equipmentFindService
 * @author Sergey Kozlov
 *
 */
@ManagedBean(name = "equipmentFindService")
@SessionScoped
public class EquipmentFindService {

	private List<Equipment> foundEquipments;
	
	
	private String eName;
	
	private String eType;
	
	private int eState;
	
	private String eAddress;
	
	@EJB
	private IEquipmentProvider ep;
	
	@PostConstruct
	void init(){
		foundEquipments = new ArrayList<Equipment>();
	}
	
	public void findEquipmentsByName(){		
		foundEquipments = ep.getEquipmentsByName(eName);
	}
	
	public void findEquipmentByAddress(){
		foundEquipments = ep.getEquipmentsByAddress(eAddress);
	}
	
	public void findEquipmentsByType(){
		foundEquipments = ep.getEquipmentsByType(eType);
	}
	
	public void findEquipmentsByState(){
		foundEquipments = ep.getEquipmentsByState(eState);
	}
	
	public List<Equipment> getFoundEquipments() {
		return foundEquipments;
	}

	public void setFoundEquipments(List<Equipment> foundEquipments) {
		this.foundEquipments = foundEquipments;
	}

	public String geteName() {
		return eName;
	}

	public void seteName(String eName) {
		this.eName = eName;
	}

	public String geteType() {
		return eType;
	}

	public void seteType(String eType) {
		this.eType = eType;
	}

	public int geteState() {
		return eState;
	}

	public void seteState(int eState) {
		this.eState = eState;
	}

	public String geteAddress() {
		return eAddress;
	}

	public void seteAddress(String eAddress) {
		this.eAddress = eAddress;
	}
}
